package com.boarsoft.boar.dir.bean;

import java.util.List;

import com.boarsoft.boar.common.TreeNode;
import com.boarsoft.boar.entity.DirInfo;

public class DirTreeNode implements TreeNode {
	private DirInfo dirInfo;
	private List<TreeNode> children;

	public DirTreeNode() {
	}

	public DirTreeNode(DirInfo dirInfo) {
		this.dirInfo = dirInfo;
	}

	public String getId() {
		return dirInfo.getId();
	}

	public String getName() {
		return dirInfo.getName();
	}

	public String getCode() {
		return dirInfo.getCode();
	}

	public int getType() {
		return dirInfo.getType();
	}

	public String getMemo() {
		return dirInfo.getMemo();
	}

	@Override
	public String getKey() {
		return dirInfo.getId();
	}

	@Override
	public void setKey(String id) {
		dirInfo.setId(id);
	}

	@Override
	public String getTitle() {
		return dirInfo.getName();
	}

	@Override
	public void setTitle(String name) {
		dirInfo.setName(name);
	}

	@Override
	public boolean getIsFolder() {
		return dirInfo.getChildCount() > 0;
	}

	@Override
	public void setIsFolder(boolean b) {
		// Not allowed
	}

	@Override
	public boolean getIsLazy() {
		return dirInfo.getChildCount() > 0;
	}

	@Override
	public void setIsLazy(boolean b) {
		// Not allowed
	}

	@Override
	public String getParent() {
		return dirInfo.getParentId();
	}

	@Override
	public void setParent(String parent) {
		dirInfo.setParentId(parent);
	}

	@Override
	public int getChildCount() {
		return dirInfo.getChildCount();
	}

	@Override
	public void setChildCount(int childCount) {
		dirInfo.setChildCount(childCount);
	}

	@Override
	public int getLevel() {
		return dirInfo.getLevel();
	}

	@Override
	public void setLevel(int level) {
		dirInfo.setLevel(level);
	}

	@Override
	public String getPath() {
		return dirInfo.getPath();
	}

	@Override
	public void setPath(String path) {
		dirInfo.setPath(path);
	}

	@Override
	public List<TreeNode> getChildren() {
		return children;
	}

	@Override
	public void setChildren(List<TreeNode> children) {
		this.children = children;
	}
}
